<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input id="key" type="text">
<input id="value" type="text">
<button id="save">添加</button>
<button id="read">读取</button>

</body>
<script type="text/javascript">
    document.getElementById("save").onclick = function () {
        var k = document.getElementById("key").value;
        var v = document.querySelector("#value").value;
        sessionStorage.setItem(k,v);
    };
</script>
</html>